<?php

/**
 * 应用配置文件
 * 统一使用数组格式，去除常量定义
 */
return [
    // 数据库配置
    'database' => [
        'type' => 'mysql',
        'host' => 'localhost',
        'port' => '3306',
        'name' => 'test',
        'user' => 'root', // 确保提供正确的用户名
        'password' => 'admin123', // 确保提供正确的密码
        'prefix' => '',
        'charset' => 'utf8mb4',
        'options' => [
            PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
            PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
            PDO::ATTR_PERSISTENT => false,
            PDO::ATTR_TIMEOUT => 1,
        ],
    ],

    // 模板引擎配置
    'template' => [
        'suffix' => '.tpl',
        'left_delimiter' => '{{',
        'right_delimiter' => '}}',
        // 在template配置部分修改
        'template_dir' => APP_PATH . 'application/view/',
        'compile_dir' => RUNTIME_PATH . 'templates/',
        'config_dir' => APP_PATH . 'config/',
        'cache_dir' => RUNTIME_PATH . 'cache/',
        'debugging' => false,  // 生产环境关闭调试
        'caching' => false,     // 开启缓存
        'cache_lifetime' => 3600  // 缓存有效期1小时
    ],


    // 错误处理配置
    'error' => [
        'default_page' => APP_PATH . 'errors/error.php',
        'default_message' => '请求的页面不存在或发生错误',
        'show_detailed_errors' => APP_DEBUG,
        'log_errors' => true,
        'error_page_404' => APP_PATH . 'errors/404.php',
        'error_page_500' => APP_PATH . 'errors/500.php',
    ],

    // 日志配置
    'log' => [
        'dir' => 'log',
        'levels' => ['debug', 'info', 'warning', 'error', 'critical'],
        'default_level' => 'info'
    ],

    // 应用配置
    'app' => [
        'debug' => APP_DEBUG,
        'charset' => 'UTF-8',
        'timezone' => 'Asia/Shanghai'
    ],

    // Session配置
    'session' => [
        'name' => 'FASTPHP_SESSION',
        'cookie_lifetime' => 0,
        'cookie_path' => '/',
        'cookie_domain' => '',
        'cookie_secure' => false,
        'cookie_httponly' => true,
        'use_strict_mode' => true,
        'use_only_cookies' => true,
        'gc_maxlifetime' => 1440,
        'save_path' => RUNTIME_PATH . 'sessions/'
    ],

    // JWT配置
    'jwt' => [
        'secret' => 'k7xP8sFg3qLmNcBvRtYwUeIoPaSdFgHjKlZxWvUyTr', // 替换为实际的密钥
        'algorithm' => 'HS256',
        'expires_in' => 3600
    ]

];
